/**
 * @Author: gaojinmeng
 * @Date: 2022/2/6 16:08
 * @Description:
 */
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import mutation from './mutation'

Vue.use(Vuex)

export default new Vuex.Store({
  state,
  actions: {
    cityChange (ctx, city) {
      ctx.commit('changeCity', city)
    }
  },
  mutations: mutation,
  getters: {
    // 类似于计算属性
    doubleCity (state) {
      return state.city + ' ' + state.city
    }
  }
})
